<!DOCTYPE html>
<html>
<head>
<meta charset="UTF-8">
<title>Insert title here</title>
<script type="text/javascript">
/* 链接分页 */
$(function(){
	$.post("openstop/app",app,"json");
});
/* 页面上读卡 */
function readCard(){
	//接入控件  读取市民卡号
	var flag=activeCPU();
	if(flag){
		flag=qzsmkocx.GetSmkNo();//获取市民卡号
	}
  var citizenCardNo=""
	if(flag){
	citizenCardNo=qzsmkocx.GetRetValue().split(",")[0];
	$("input[name='citizenCardNo']").val(citizenCardNo);
	$("input[name='newCitizenCardNo']").val(citizenCardNo);
  		$.post("business/queryInfoByReadCard",{citizenCardNo:citizenCardNo},function(json){
  			 $(json).each(function(n,item){
  				$("input[name='cardPName']").val(item.cardPName);
				$("input[name='cardPCode']").val(item.cardPCode);
				if(item.customerName!=null){
					$("input[name='customerName']").val(item.customerName);
					$("input[name='paperTypeName']").val(item.paperTypeName);
					$("input[name='paperType']").val(item.paperType);
					$("input[name='paperNo']").val(item.paperNo);
				}
  			}) 
  		},"json")
	}

    };
  //拼接数据库中数据显示在html页面是
	 function app(json){
		var content="";
		var numPerPage=json.numPerPage;
		var currentPage=json.currentPage;
		var totalCount=json.totalCount;
		var pageCount=json.pageCount
	 	/* console.log();return ;  */
		// 没有数据
		if (json.list.length == 0) {
			 content+="<tr><td colspan='4' align='center' >未查询到数据</td></tr>";
		}
		$(json.list).each(function (index, item) {
			  content+="<tr onmouseover='moveoverMouseS(this)' onmouseout='moveoutMouse(this)' align='center'><td width='2%'><input name='ids' onclick='test(this)'  type='checkbox'></td><td width='10%'>"+item.appKindName+
	          "</a></td><td width='10%'>"+item.appType+"</td><td width='10%'>"+item.appStatus+"</td><td width='10%'>"+getDate(item.validBegin)+
	         "</td><td width='10%'>"+getDate(item.validEnd)+"</td></tr>"; 	
		});
	
		
		$("#AppOpen").html(content);
		$("input[name='numPerPage']").val(numPerPage);
		$("input[name='currentPage']").val(currentPage); 
		 $("input[name='pageCount']").val(pageCount);
		 $("input[name='totalCount']").val(totalCount);
		 $("#totalCountByAppOpenStop").text("条，共"+totalCount+"条");
		      $("div.pagination").each(function(){
		var $this = $(this);
		$this.pagination({
			targetType:"navTab",
			rel:"AppOpen",
			totalCount:totalCount,
			numPerPage:numPerPage,
			pageNumShown:10,
			currentPage:currentPage,
			callback:app
		});
	});
		      return true;
	  }
//柜员未选中列表的一个以及柜员只能选中一个复选框——————————————跳出弹窗
		  $("#fileField").click(function(){
		var val=$('input:checkbox[name="ids"]:checked').val();
		       if(val==null){
		      	 alertMsg.info('请选择一条记录！');
		      	 return false;
		       }
		       /* 柜员未选择具体费用，跳出弹窗，选择费用 */
		        var adl=$('input:checkbox[name=appKindName]:checked').adl();
		       if(adl==null){
		    	   alertMsg.info('请选择具体费用！');
		    	   return false;
		       }  
		       if($("input[name='ids']:checked").length > 1){
		 	      alertMsg.warn("不能选择多于1条数据！")
		 	      return false;	
		 	}/* else{
		    	$.post("openstop/appopen", $("#appInfo").serialize(),navTabAjaxDone,"json")
		     }  */
		       return false;
		 });
//柜员未选中列表的一个以及柜员只能选中一个复选框——————————————跳出弹窗
					  $("#fileFiel").click(function(){
					var val=$('input:checkbox[name="ids"]:checked').val();
					     if(val==null){
					    	 alertMsg.info('请选择一条记录！');
					    	 return false;
					     }
					       /* 柜员未选择具体费用，跳出弹窗，选择费用 */
			 	       var adl=$('input:checkbox[name=price]:checked').adl();
					       if(adl==null){
					    	   alertMsg.info('请选择具体费用！');
					    	   return false;
					       } 
					     if($("input[name='ids']:checked").length > 1){
					      alertMsg.warn("不能选择多于1条数据！")
					      return false;	
					}else{
		    	$.post("openstop/appstop", $("#appInfo").serialize(),navTabAjaxDone,"json")
		     } 
		     return false;
		 });
					/*   页面上全选/反选按钮 */
					  var isCheckAll = false;
						function swapCheck() {
							if (isCheckAll) {
								$("input[type='checkbox']").each(function() {
									this.checked = false;
								});
								isCheckAll = false;
							} else {
								$("input[type='checkbox']").each(function() {
									this.checked = true;
								});
								isCheckAll = true;
							}
						}
						
						
						//应用开通写卡
					 	  $("#fileField").click(function()
					     {
							 qzsmkocx.updateBaseInfo(adf, updateInfo)
							 qzsmkocx.updatePersonInfo(adf,updateInfo)
						  });
						 //应用停用写卡
						 $("#fileFiel").click(function()
						 {
							 qzsmkocx.updateBaseInfo(adf, updateInfo)
							 qzsmkocx.updatePersonInfo(adf,updateInfo)
						 }); 
						
						
			

</script>
</head>
<body>
					
					<form id="AppOpenReg"  method="post" action="openstop/app"class="pageForm required-validate" onsubmit="return validateCallback(this,app);">
					        <input type="hidden" name="currentPage" value="" /> 
							<input type="hidden" name="numPerPage" value="" />
							<input type="hidden" name="pageCount" value="" />
					<div class="pageFormContent" >
					  <fieldset>
					  <p>
					  <label>市民卡号：</label> 
					<input id="citizenCard" name="citizenCardNo" type="text" readonly="readonly" />
					<input name="newCitizenCardNo" type="hidden" readonly="readonly"/>
					<input title="读卡" type="submit" value="读卡" onclick="readCard()"   > 
					</p>
					</fieldset>
					<fieldset>
					
					            <legend><strong>卡信息区</strong></legend>  
								<p>
									<label>证件类型：</label>
									<input name="paperTypeName" type="text"  value="" readonly="readonly"/>
									<input name="paperType" type="hidden">
								</P>
								<p>
									<label>证件号码：</label>
									<input name="paperNo" type="text" value="" readonly="readonly"/>
									
								</P>
								<p>
									<label>姓名：</label>
									<input name="customerName" type="text"  value="" readonly="readonly"/>
									
								</P>
								<p>
									<label>卡产品：</label>
									<input name="cardPName" type="text"  value="" readonly="readonly"/>
									<input name="cardPCode" type="hidden">
								</P>
								</fieldset>
				<!-- 	   <div class="formBar">
					  <ul> 
					       <li>
					            <div class="buttonActive" ><div class="buttonContent" ><button type="submit" title="查询">查询</button></div></div>
					      </li>
					 </ul>
					  </div> -->
					 </div>
					   </form>	
					
					
					<form id="appInfo" method="post" action="openstop/appopen" class="pageForm required-OpenApp" onsubmit="return validateCallback(this,navTabAjaxDone);">
					<div class="pageContent">
					 <input name="singletasked" type="checkbox" style="display:none" value="xxxxxxxxxxx" checked>	
					<table class="table" width="1200" layoutH="300" >
					<thead>
										<tr align="center">
										     <th width="2%"><input type="checkbox" id="ids" name="appopen" group="fight" onclick="swapCheck()"></th>
										     <th width="10%" >应用分类</th>
										     <th width="10%" >应用类型</th>
										    <th width="10%" name="Status" id="app" >应用状态</th>
										    <th width="10%" >有效期(起)</th>
										    <th width="10%" >有效期(止)</th>
										</tr>
										</thead>
					<tbody id="AppOpen">
					
					</tbody>
					</table>
						<div class="panelBar">
							<div class="pages">
								<span>显示</span>
								<select id="numPerPageByAppOpenStop" name="numPerPage" onchange="paging(this,$('#AppOpen'),AppOpen)">
									<option value="20">20</option>
									<option value="30">30</option>
									<option value="50">50</option>
									<option value="100">100</option>
								</select>
								<span id="totalCountByAppOpenStop" >条，共${totalCount}条</span>
								</div>
						<div callback='app' id="paginationByApplicationTypeDefinition" rel="AppOpen" class="pagination" targetType="navTab" totalCount="200" numPerPage="5" pageNumShown="5" currentPage="1"></div>

		</div>	
				

						</div>
					
					<div class="formBar">
					
					    <!-- <p>
							<label>收费：</label>
							<select id="price" name="appKindName" class="required">
							<option  class="required" value="50">请选择</option>
							<option class="require" value="50">50</option>
							<option class="require" value="50">100</option>
							<option class="require" value="50">150</option>
							<option class="require" value="50">200</option>
			                </select>
						</P> -->
						<ul>
					<li>
					           <input type="submit" id="fileField" title="应用开通" size="28" value="应用开通"   /> 
					           <input type="button" id="fileFiel"  title="应用停用" size="28" value="应用停用"  /> 
					</li>
					</ul>
					</div>
					</div>
					</form>
					
					
					</body>
					</html>